 #include "../include/HttpBcstDataProvider.h"
#include "../include/WindowsTickSource.h"
#include "../include/HttpDataSource.h"
#include "../include/WindowsHttpClient.h"

HttpBcstDataProvider::HttpBcstDataProvider(std::string statusURL,std::string slotsURL,std::string adListURL)
{
	m_statusURL=statusURL;
	m_slotsURL=slotsURL;
	m_adListURL=adListURL;
	m_pHttpClient=0;
}

HttpBcstDataProvider::~HttpBcstDataProvider(void)
{
	if (m_pHttpClient!=0)
	{
		delete m_pHttpClient;
		m_pHttpClient=0;
	}
}



DataSource* HttpBcstDataProvider::CreateDataSource(string csAreaCode ,int type)
{
	m_pHttpClient=new WindowsHttpClient();
	HttpDataSource* pHttpDataSource=new HttpDataSource(m_pHttpClient);
	pHttpDataSource->SetStatusURL(m_statusURL);
	pHttpDataSource->SetSlotsURL(m_slotsURL);
	pHttpDataSource->SetAdListURL(m_adListURL);
	pHttpDataSource->SetAreaCode(csAreaCode);

	//string str = UnicodeToUTF8(csAreaCode.c_str());

	pHttpDataSource->SetType(type);
	return pHttpDataSource;
}
TickSource* HttpBcstDataProvider::CreateTickSource()
{
	return new WindowsTickSource();
}